﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Collections;

namespace BartonNavigation
{
    public class BNavigationManager
    {
        private DataTable node_source;
        public bool isValid { get; set; }
        
        public static BNavigationManager Create(DataTable dt)
        {
            BNavigationManager manager = new BNavigationManager(dt);
            if (manager.ValidCheck())
            {
                manager.isValid = true;
            }
            return manager;
        }

        public BNavigationManager(DataTable dt)
        {
            this.node_source = dt;
        }

        public bool ValidCheck()
        {
            if (node_source == null)
                return false;
            if (node_source.Rows.Count == 0)
                return false;
            if (!node_source.Columns.Contains("region") || !node_source.Columns.Contains("building")
             || node_source.Columns.Contains("store_id"))
                return false;
            return true;
        }
    }
}
